Simple ASP Password Protection
For simple password protection of a page or a series of pages,
Active Server Pages (ASP) can be used. The concept is simple: when a
password protected page is loaded an ASP script is executed to see
if the user entered the correct password. Setting it up
is easy.
Create a login form for your password protected pages. For
example: set up a site entry page that has the password form. Once a
user enters the password, the protected page can have links to all
of the other other protected pages - kind of like a password
protected home page.
The script uses a Session Variable to save the
User's Password. The user only needs to enter the Password
once. If this is not desired, the script can be modified to
remove the session variable. Once the User enters a valid password,
they can access the protected pages. Entering the password again has
no affect because the password is valid until:
- The ASP Session times out after 20 minutes (default) of idle
time, or the user has left your site for more than 20 minutes.
- The User exits the browser.
For the example: Create a form with a one line text box like the
one shown below.
- Edit the field properties and enter pwfield
for the name and select the Yes radio
button for the Password field.
- Edit the form properties and select Send to
other: Click on Options and enter the name of your
ASP protected page or directory page for your password protected
page. This one uses protected.asp for a page
name.
- Try it and get the script on the next page!
For a method that uses a Microsoft Access database see the ASPLogin freeware
at OceanTek. Also see the Authentication Tutorial at LearnAsp.com or one of
the tutorials at TAKempis. |